/*
 *  v4lcam.h
 *  libCV
 *
 *  Created by Gregory Koch on 11/03/11.
 *  Copyright 2011 IFlyBotIV. All rights reserved.
 *
 */

#ifndef V4LCAM_H
#define V4LCAM_H

#include <time.h>
#include <sys/time.h>
#include <linux/videodev.h>
#include "libCV.h"

#define V4L_RGB24_640_480 0
#define V4L_GREY8_640_480 1
#define V4L_RGB24_320_240 2
#define V4L_GREY8_320_240 3
#define V4L_RGB24_160_120 4
#define V4L_GREY8_160_120 5

#define CHANNEL 0

typedef struct v4lcam_s{
	int fdv;
	image_t framebuf;
	struct video_mmap mm;
    struct video_mbuf mbuf;
    unsigned char *buffer;
    unsigned int format;
    float fps;
    struct timeval tv;
} v4lcam_t;

v4lcam_t v4lcam_open(char* device, unsigned int format);
void v4lcam_close(v4lcam_t camera);
void v4lcam_grab_image(v4lcam_t *camera);

#endif

